home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Sample Code / Snippets / Networking / Transition Queue Watcher / ATQFix.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-01-08  |  1.7 KB  |  57 lines  |  [TEXT/KAHL]

  1. /*
  2.  * File: ATQFix.c
  3.  *_________________________________________________________________________
  4.  *
  5.  * DTS Code Sample
  6.  *    
  7.  * ©1992 Apple Computer, Inc.
  8.  *
  9.  * Replacement code for LAPAddATQ and LAPRmvATQ for Think C programmers 
  10.  * to fix the glue code to fix a bug in the Think C library supplied via 
  11.  * the MPW Interface.o file.  The glue code does not restore the stack to
  12.  * it's original condition.  Use the following code as opposed
  13.  * to that in the Think C library instead.
  14.  *
  15.  *_________________________________________________________________________
  16.  */
  17.  
  18. #ifndef __TYPES__
  19. #include <Types.h>
  20. #endif
  21.  
  22. #define LAPAddATQCall     0x17
  23. #define LAPRmvATQCall    0x18
  24. #define LAPMgrPtr    0xB18
  25. #define LAPMgrCall    2
  26.  
  27. /**********  Prototypes ****************************/
  28. pascal OSErr LAPAddATQFix(ATQEntryPtr theATQEntry);
  29. pascal OSErr LAPRmvATQFix(ATQEntryPtr theATQEntry);
  30.  
  31.  
  32. pascal OSErr LAPAddATQFix(ATQEntryPtr theATQEntry)
  33. {
  34.     asm {
  35.         MOVE.W     #LAPAddATQCall,D0    /* D0 selector $0017 = LAPAddATQ */
  36.         MOVEA.L    theATQEntry,A0          /* A0 -> ATQ Proc */
  37.         MOVEA.L    LAPMgrPtr,A1            /* Set up to call LAP Manager */
  38.         JSR        LAPMgrCall(A1)       /* call LAP Manager */
  39.         MOVE.W       D0,12(A6)            /* move result in D0 onto the stack */
  40.     }
  41. }
  42.  
  43. pascal OSErr LAPRmvATQFix(ATQEntryPtr theATQEntry)
  44. {
  45.     asm {
  46.         MOVE.W     #LAPRmvATQCall,D0    /* D0 selector $0018 = LAPRmvATQ */
  47.         MOVEA.L    theATQEntry,A0          /* A0 -> ATQ Proc */
  48.         MOVEA.L    LAPMgrPtr,A1            /* Set up to call LAP Manager */
  49.         MOVE.L     (A7)+,(A7)              /* Move return address up 4 bytes */
  50.         JSR        LAPMgrCall(A1)       /* call LAP Manager */
  51.         MOVE.W       D0,12(A6)            /* move result in D0 onto the stack */
  52.     }
  53. }
  54.  
  55. /*
  56.  * End file: ATQFix.c
  57.  */